﻿@model NB.MGJ.Model.AntiFleeing_Warehouse
@using NB.MGJ.Model
@{
    Layout = null;
    AntiFleeing_Warehouse a = ViewBag.WareHouse as AntiFleeing_Warehouse;
}

@*<div>新增仓库管理</div>*@
<style>
    #form_EditWareHouse.form_EditWareHouse .form-group {
        margin-bottom: 15px;
    }
</style>
<form class="form_EditWareHouse form-horizontal" id="form_EditWareHouse" role="form" onkeydown="if(event.keyCode==13){return false;}">

    <div class="form-group">
        <label class="col-sm-2 control-label">所属机构：</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" name="EnterpriseId" id="EnterpriseId" value="@a.EnterpriseName" disabled="disabled">
        </div>
        <label class="col-sm-2 control-label">
            <span style=" color:red;">*</span>
            仓库名称：
        </label>
        <div class="col-sm-4">
            <input type="text" class="form-control" placeholder="请输入仓库名称" name="WarehouseName" value="@a.WarehouseName" maxlength="25">
        </div>

    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">地址：</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" placeholder="请输入地址" name="Address" value="@a.Address" maxlength="50">
        </div>
        <label class="col-sm-2 control-label">所属片区：</label>
        <div class="col-sm-4">
            <select class="form-control" id="SaleAreaId" name="SaleAreaId"></select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">联系人：</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" placeholder="请输入联系人" name="Contacts" value="@a.Contacts" maxlength="20">
        </div>
        <label class="col-sm-2 control-label">联系方式：</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" placeholder="请输入手机或电话(如：0511-4405222、021-87888822)" name="ContactTel" value="@a.ContactTel" maxlength=13>
        </div>
    </div>
    <div class="form-group" style="margin-bottom:15px;">
        <label class="col-sm-2 control-label">备注：</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="Remark" value="@a.Remark">
        </div>
    </div>
</form>
<script>
    $(function () {    
        $.ajax({
            url: "/Manager/GetEditArealist?Id="+@a.SaleAreaId,
            
            success: function (data)
            {
                var htmlsel = '';
                $.each(data, function (i, item) {
                    if (item.Selected) {
                        htmlsel += "<option  selected value='" + item.Value + "'>" + item.Text + "</option>";
                    }
                    else {
                        htmlsel += "<option  value='" + item.Value + "'>" + item.Text + "</option>";
                    }
                });
                $("#SaleAreaId").append(htmlsel);
              //  $("#SaleAreaId").html($option);
            }
        });

    })
    function ChangeValue(_this) {
        $("#Eid").val($(_this).children("option:selected").attr("id"));
    }

    $('#form_EditWareHouse').bootstrapValidator({
        group: '.rowGroup',
        fields: {
            EnterpriseId: {
                validators: {
                    notEmpty: {
                        message: '所属机构不能为空'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9_ \u4e00-\u9fa5]+$/,
                        message: '所属机构不能输入符号'
                    },
                    stringLength: {
                        max: 20,
                        message: '所属机构最大长度为20',
                    },
                }
            },
            Address: {
                validators: {
                    regexp: {
                        regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
                        message: '地址不能输入符号'
                    },
                    stringLength: {
                        max: 50,
                        message: '地址最大长度为50',
                    },
                }
            },
            Contacts: {
                validators: {
                    regexp: {
                        regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
                        message: '联系人不能输入符号'
                    },
                    stringLength: {
                        max: 20,
                        message: '联系人最大长度为20',
                    },
                }
            },
            WarehouseName: {
                validators: {
                    notEmpty: {
                        message: '仓库名称不能为空'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
                        message: '仓库名称不能输入符号'
                    },
                    stringLength: {
                        max: 25,
                        message: '仓库名称最大长度为25'
                    }
                }
            },
            ContactTel: {
                validators: {
                    regexp: {
                        regexp: /^[0-9]*$/,
                        message: '联系方式格式错误'
                    }
                }
            },
        }
    });

</script>